﻿using System;

namespace Fermat
{
    /// <summary>
    /// 证明当n=3时，x,y,z<=10000,费马大定理成立
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            long[] arry = new long[10000];
            bool flag = true;
            for (int i = 1; i <= 10000; i++)
            {
                arry[i - 1] = Convert.ToInt64(Math.Pow(i, 3));
            }
            for (int i = 0; i < 10000; i++)
            {
                for (int j = i; j < 10000; j++)
                {
                    for (int k = j; k < 10000; k++)
                    {
                        if (arry[i] + arry[j] == arry[k])
                        {
                            flag = false;
                            if (flag)
                                break;
                        }
                        if (flag)
                            break;
                    }
                    if (flag)
                        break;
                }
            }
            if (flag)
                Console.WriteLine("费马大定理成立");
            else
                Console.WriteLine("费马大定理不成立");

            Console.ReadKey();
        }
    }
}
